<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page session="false"%>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Athenaeum : Organizations</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<jsp:include page="../assets/header.jsp" />

</head>
<body>
	<jsp:include page="../assets/navbar-top.jsp" />
	<div class="page-wrap">
		<div class="container-fluid">
			<div class="row row-wrap">
				<div class="col-md-3">
					<jsp:include page="sidebar.jsp" />
				</div>
				<div class="col-md-9">
					<p>
						<a href="<c:url value="/account/organization/index"/>"
							class="btn btn-default">Create new organization</a>
					</p>
					<div class="panel panel-default">
						<div class="panel-heading">
							<h1 class="panel-title">Organizations</h1>
						</div>
						<div class="panel-body">
							<c:if test="${empty userorganizations}">
								<div class="col-md-8">
									<p>You are not a member of any organization.</p>
								</div>
								<div class="col-md-4"></div>
							</c:if>
							<c:if test="${not empty userorganizations}">
								<div class="col-md-12">
									<table class="table table-striped" id="userorganizations"
										style="width: '100%'">
										<thead>
											<tr>
												<th>Title</th>
												<th>Description</th>
												<th>Email</th>
												<th>Actions</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach var="organization" items="${userorganizations}">
												<tr>
													<td><a
														href="${pageContext.request.contextPath}/account/organization/${organization.id}/edit">${organization.title}</a></td>
													<td>${organization.description}</td>
													<td>${organization.email}</td>
													<td><a
														href="${pageContext.request.contextPath}/account/organization/${organization.id}/delete">Delete</a></td>
												</tr>
											</c:forEach>
										</tbody>
									</table>
								</div>
							</c:if>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="../assets/footer.jsp" />
	<script type="text/javascript">
		$(document).ready(function() {
			$('#userorganizations').dataTable({
				"bLengthChange" : false,
			});
		});
	</script>
</body>
</html>

